package com.example.senior_bug.Componet;

import com.example.senior_bug.Service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.Date;

@Component
public class MyDailyTake {

    @Autowired
    private OrderService orderService;

    @Scheduled(cron = "0 0 0 * * ?")//定时修改租赁到期商品状态
    public void DoTask() {
        try {
            orderService.returnedOrder();

            Date date = new Date();

            System.out.println(date.toString() + ":hello");
        } catch (Exception e) {
            System.out.println(e.getMessage());
        }
    }


}
